from sanic import Sanic
from login import app_account
from sendsms import app_sendsms
from access_token import app_access_token
from Login_withoutpwd import app_login_pwd
from conn_mysql_redis import ConnRedis, ConnMysql, InsertConnMysql

app = Sanic(__name__) 

app.blueprint(app_account)
app.blueprint(app_sendsms)
app.blueprint(app_access_token)
app.blueprint(app_login_pwd)

@app.listener('after_server_start')
async def notify_server_started(app, loop):

    ConnMysql(loop=loop)
    ConnRedis(loop=loop)
    InsertConnMysql(loop=loop)
    print('Server MySql and Redis successfully started!')


if __name__ == "__main__":
  app.run(host='0.0.0.0',port=8000,debug=True)
